package com.exchange.interfaces.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.exchange.common.annotation.Log;
import com.exchange.common.enums.BusinessType;
import com.exchange.interfaces.domain.JgImplementPublish;
import com.exchange.interfaces.service.IJgImplementPublishService;
import com.exchange.common.core.controller.BaseController;
import com.exchange.common.core.page.TableDataInfo;
import com.exchange.common.core.domain.AjaxResult;
import com.exchange.common.utils.poi.ExcelUtil;

/**
 * 数据交换_实施清单 信息操作处理
 * 
 * @author exchange
 * @date 2019-06-04
 */
@Controller
@RequestMapping("/interfaces/jgImplementPublish")
public class JgImplementPublishController extends BaseController
{
    private String prefix = "interfaces/jgImplementPublish";
	
	@Autowired
	private IJgImplementPublishService jgImplementPublishService;
	
	@RequiresPermissions("interfaces:jgImplementPublish:view")
	@GetMapping()
	public String jgImplementPublish()
	{
	    return prefix + "/jgImplementPublish";
	}
	
	/**
	 * 查询数据交换_实施清单列表
	 */
	@RequiresPermissions("interfaces:jgImplementPublish:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(JgImplementPublish jgImplementPublish)
	{
		startPage();
        List<JgImplementPublish> list = jgImplementPublishService.selectJgImplementPublishList(jgImplementPublish);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出数据交换_实施清单列表
	 */
	@RequiresPermissions("interfaces:jgImplementPublish:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(JgImplementPublish jgImplementPublish)
    {
    	List<JgImplementPublish> list = jgImplementPublishService.selectJgImplementPublishList(jgImplementPublish);
        ExcelUtil<JgImplementPublish> util = new ExcelUtil<JgImplementPublish>(JgImplementPublish.class);
        return util.exportExcel(list, "jgImplementPublish");
    }
	
	/**
	 * 新增数据交换_实施清单
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存数据交换_实施清单
	 */
	@RequiresPermissions("interfaces:jgImplementPublish:add")
	@Log(title = "数据交换_实施清单", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(JgImplementPublish jgImplementPublish)
	{		
		return toAjax(jgImplementPublishService.insertJgImplementPublish(jgImplementPublish));
	}

	/**
	 * 修改数据交换_实施清单
	 */
	@GetMapping("/edit/{implementPublishId}")
	public String edit(@PathVariable("implementPublishId") String implementPublishId, ModelMap mmap)
	{
		JgImplementPublish jgImplementPublish = jgImplementPublishService.selectJgImplementPublishById(implementPublishId);
		mmap.put("jgImplementPublish", jgImplementPublish);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存数据交换_实施清单
	 */
	@RequiresPermissions("interfaces:jgImplementPublish:edit")
	@Log(title = "数据交换_实施清单", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(JgImplementPublish jgImplementPublish)
	{		
		return toAjax(jgImplementPublishService.updateJgImplementPublish(jgImplementPublish));
	}
	
	/**
	 * 删除数据交换_实施清单
	 */
	@RequiresPermissions("interfaces:jgImplementPublish:remove")
	@Log(title = "数据交换_实施清单", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(jgImplementPublishService.deleteJgImplementPublishByIds(ids));
	}
	
}
